package com.wwt.blog.controller;

import com.wwt.blog.service.LoginService;
import com.wwt.blog.vo.Result;
import com.wwt.blog.vo.param.LoginParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class LoginController {
    @Resource
    LoginService loginService;
    @PostMapping("/login")
    //登录 传入账号密码
    public Result login( @RequestBody LoginParam loginParam){
        return loginService.findUser(loginParam);
    }
    //注销 删除redis中的token
    @GetMapping("/logout")
    public Result loginOut(@RequestHeader("Authorization") String token){
        return  loginService.logOut(token);
    }
}
